package com.xq.springboot.mapper;

import com.xq.springboot.pojo.People;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author xq
 * @version 1.0
 * @date 2021/4/18 16:30
 * @description 人们数据接口层
 */
//@Mapper // 如果在Application类中加了MapperScan(basePackages = {"com.xq.springboot.mapper"}),就不用加@Mapper了；
public interface PeopleMapper {
    /**
     * 新增人们
     * @param people 人们对象
     * @return 返回添加状态
     */
//    @Insert("insert into `people` (`name`,address,age,create_time) values (#name,#{address},#{age},#{createTime});")
    int addPeople(People people);

    /**
     * 根据id删除人们
     * @param id 人们id
     * @return 返回删除状态
     */
//    @Delete("delete from people where id = #{id}")
    int deleteById(@Param("id") Integer id);

    /**
     * 根据id修改人们数据
     * @param people 人们对象
     * @return 返回修改状态
     */
//    @Update("update people set name = #{name},address=#{address},age=#{age},create_time=#{createTime}  where id = #{id} ;")
    int updatePeopleById(People people);

    /**
     * 查询所有人们数据
     * @return 返回人们集合
     */
//    @Select("select * from people")
    List<People> getPeopleAll();
}
